<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <script>



    function setFontPathByName(name, path) {
      let styleNode = document.createElement("style");
      styleNode.setAttribute("type", "text/css");
      styleNode.innerHTML = `    @font-face {
      font-family: '${name}';
      src: url('${path}');
    }`;
      let headNode = document.querySelector('head');
      headNode.appendChild(styleNode)
    }
  </script>




</head>

<body>
  <p id="ppppp">2222</p>
  <img src="./t.svg" onload="SVGInject(this)" />
  <script src="svg-inject.js"></script>

  <script>
   var path = window.prompt("getFontPaths");
   var obj = JSON.parse(path)


   var oobj = `@font-face {
  font-family: Symbol;
  src: url('lttf:///private/var/containers/Bundle/Application/2CC90C8A-B871-4A44-8E2B-F95DACB7307A/讯飞智教学.app/Symbol.ttf');}
@font-face {
  font-family: unincomponents;
  src: url('lttf:///private/var/containers/Bundle/Application/2CC90C8A-B871-4A44-8E2B-F95DACB7307A/讯飞智教学.app/unincomponents.ttf');}
@font-face {
  font-family: MT Extra;
  src: url('lttf:///private/var/containers/Bundle/Application/2CC90C8A-B871-4A44-8E2B-F95DACB7307A/讯飞智教学.app/MT Extra.ttf');}
@font-face {
  font-family: Times New Roman;
  src: url('lttf:///private/var/containers/Bundle/Application/2CC90C8A-B871-4A44-8E2B-F95DACB7307A/讯飞智教学.app/Times New Romani.ttf');font-style: italic;}
@font-face {
  font-family: Times New Roman;
  src: url('lttf:///private/var/containers/Bundle/Application/2CC90C8A-B871-4A44-8E2B-F95DACB7307A/讯飞智教学.app/Times New Roman.ttf');}`
   
   obj.forEach(element => {
    const [fontFamily, path] = Object.entries(element)[0];
    setFontPathByName(fontFamily, path);

   });

  // let styleNode = document.createElement("style");
  //     styleNode.setAttribute("type", "text/css");
  //     styleNode.innerHTML = oobj;
  //     let headNode = document.querySelector('head');
  //     headNode.appendChild(styleNode)

    SVGInject(document.querySelectorAll("img.injectable"));
  </script>
</body>

</html>